#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <vector>

using namespace std;

struct ListNode {
    int val;
    ListNode* next;
    ListNode(int x) : val(x), next(NULL) {}
};

struct TreeNode {
    int val;
    TreeNode* left;
    TreeNode* right;
    TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class Solution {
   public:
    bool findNumberIn2DArray(vector<vector<int> >& matrix, int target) {
        if (matrix.size() == 0 || matrix[0].size() == 0)
            return false;
        int horizon = matrix[0].size();  //横向宽度
        int vertical = matrix.size();    //纵向宽度
        int posX = 0;
        int posY = horizon - 1;
        while (posX >= 0 && posX < vertical && posY >= 0 && posY < horizon) {
            if (matrix[posX][posY] == target) {
                return true;
            }
            while (posY >= 0 && posX < vertical &&
                   matrix[posX][posY] > target) {
                posY--;
            }
            while (posY >= 0 && posX < vertical &&
                   matrix[posX][posY] < target) {
                posX++;
            }
        }
        return false;
    }
};
int main() {
    cout << "Hello, World!";
    return 0;
}